<?php

header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
require("../config.php");

					  $rez_user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE user = '".$user."'"));
					  $rez_harta = mysql_fetch_array(mysql_query("SELECT * FROM `c_harti` WHERE id = '".$rez_user['harta']."'"));
					  $rez_planeta = mysql_fetch_array(mysql_query("SELECT * FROM `planete` WHERE user = '".$user."' AND id = '".$planeta."'"));
					  	  
					  echo '<img src="img/'.$rez_harta["imagine"].'" width="350" height="350" border="0" />';
					  for($i=1;$i<=16;$i++)
					  			{ 
								$rez_verificare_cladiri = mysql_fetch_array(mysql_query("SELECT * FROM `cladiri` WHERE planeta = '".$planeta."' AND santier = '".$i."'"));	
								if($rez_verificare_cladiri == 0)
												{
												 $rez_actiuni_locale = mysql_num_rows(mysql_query("SELECT * FROM `actiuni_locale` WHERE `planeta` = '".$planeta."' AND `santier` = '".$i."' AND `tip` = 'construire'"));
												 list($santier_x, $santier_y) = explode('@', $rez_harta["santier".$i]);
												 $santier_x += 90;
												 $santier_y += 50;
												 $z_index = $i+4;
												 if($rez_actiuni_locale == 0)
												 	{
													 echo '<a href="javascript:void(0)"><img src="img/santier.png" width="60" height="60" style="position: absolute; left: '.$santier_x.'px; top: '.$santier_y.'px;" onclick="construire_frame(\''.$i.'\', \''.$i.'\');" onmousemove="hint(\'Santier\', \''.$i.'\', event);" onmouseout="hint_hide();" alt="" border="0" /></a>';	
													}else{
													 echo '<img src="img/santier_in_lucru.png" width="60" height="60" style="position: absolute; left: '.$santier_x.'px; top: '.$santier_y.'px;" onmousemove="hint(\'Santier in lucru!\', \'\', event);" onmouseout="hint_hide();" alt="" border="0" />';
													}
													
																
								}
								else
								{
								$rez_cladiri = mysql_fetch_array(mysql_query("SELECT * FROM `cladiri` WHERE planeta = '".$planeta."' AND santier = '".$i."'"));
							 	$rez_ccladiri = mysql_fetch_array(mysql_query("SELECT * FROM `c_cladiri` WHERE id = '".$rez_cladiri['nume']."'"));	
									list($santier_x, $santier_y) = explode('@', $rez_harta["santier".$i]);
									$santier_x += 90; $santier_y += 50;
									$z_index = $i+4;
								  echo '<a href="javascript:void(0)"><img src="img/bdg_'.$rez_ccladiri["avatar"].'" width="60" height="60" style="z-index: '.$z_index.';position: absolute; left: '.$santier_x.'px; top: '.$santier_y.'px;" onmousedown="javascript:optiuni_structura(\''.$rez_cladiri["nume"].'\', \'\');" onmousemove="hint(\'<b>'.$rez_ccladiri["nume"].'</b>\', \'Nivel: '.$rez_cladiri["nivel"].'\', event)" onmouseout="hint_hide();" alt="" border="0" /></a>'; }
					  }
mysql_close();

?>